<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新鲜水果</title>
    <link rel="shortcut icon" href="favicon.ico" />
    <link rel="stylesheet" href="/static/css/base.css">
    <link rel="stylesheet" href="/static/css/common.css">
    <link rel="stylesheet" href="/static/css/goods.css">
    <link rel="stylesheet" href="/static/css/style.css">
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
    <script src='/static/script/SimplePagination.js'></script>
    <script src="/static/script/base.js"></script>
</head>

<body>
    <!-- 快捷导航模块开始 -->
    <section class="shortcut">
        <div class="width">
            <div class="fl">
                <ul>
                    <li>食品网欢迎您！&nbsp;</li>
                    <li>
                        请<a href="/loginForm" class="style_green">登录</a>
                        <a href="/registerForm" class="style_green">&nbsp;免费注册</a>
                    </li>
                </ul>
            </div>
            <div class="fr">
                <ul>
                    <li>我的订单</li>
                    <li>|</li>
                    <li>我的食品网<span></span></li>
                    <li>|</li>
                    <li>食品网会员</li>
                    <li>|</li>
                    <li>关注我们<span></span></li>
                    <li>|</li>
                    <li>客户服务<span></span></li>
                    <li>|</li>
                    <li>网站导航<span></span></li>
                </ul>
            </div>
        </div>
    </section>
    <!-- 快捷导航模块结束 -->
    <!-- 头部制作模块开始 -->
    <header class="header width">
        <a href="/index" class="logo"></a>
        <div class="search">
            <input type="search" name="" id="id_key" placeholder="中华老字号">
            <button id="id_search">搜索</button>
        </div>
        <div class="hotwords">
            <a href="/search/?keyword=%E8%91%A1%E8%90%84%E9%85%92&page=0&size=10" class="style_red">葡萄酒</a>
            <a href="/search/?keyword=%E9%A5%BC%E5%B9%B2%E8%9B%8B%E7%B3%95&page=0&size=10">饼干蛋糕</a>
            <a href="/search/?keyword=%E7%81%AB%E8%85%BF&page=0&size=10">火腿</a>
            <a href="/search/?keyword=%E9%85%92%E6%9D%AF&page=0&size=10">酒杯</a>
            <a href="/search/?keyword=%E8%86%A8%E5%8C%96%E9%A3%9F%E5%93%81&page=0&size=10">膨化食品</a>
            <a href="/search/?keyword=%E6%B0%B4%E6%9E%9C&page=0&size=10">水果</a>
            <a href="/search/?keyword=%E7%8C%AA%E8%82%89&page=0&size=10">猪肉</a>
        </div>
    </header>
    <!-- 头部制作模块结束 -->
    <!-- 右侧边栏制作开始 -->
    <div class="sidebar">
        <ul class="box">
            <li class="user" id="id_acount">
                <a href="/user/acount">
                    <span></span>
                    账号
                </a>
            </li>
            <li class="shopping_bag">
                <a href="#" id="id_cart">
                    <span></span>
                    购物车<br>
                    <i class="count">8</i>
                </a>
            </li>
            <li class="order">
                <a href="#">
                    <span></span>
                    订单
                </a>
            </li>
            <li class="collection" id="id_collection">
                <a href="#">
                    <span></span>
                    收藏
                </a>
            </li>
            <li class="complaint">
                <a href="#">
                    <span></span>
                    投诉
                </a>
            </li>
            <li class="top">
                <a href="#top">
                    <span></span>
                </a>
            </li>
        </ul>
    </div>
    <!-- 右侧边栏制作结束 -->
    <!-- nav模块开始 -->
    <nav class="nav">
        <div class="width">
            <div class="dropdown">
                <div class="dt">全部商品分类</div>
                <div class="dd">
                    <ul>
                        <li><a href="/search/?keyword=%E6%96%B0%E9%B2%9C%E6%B0%B4%E6%9E%9C&page=0&size=10">新鲜水果<span>></span></a></li>
                        <li><a href="/search/?keyword=%E8%8F%9C&page=0&size=10">蔬菜蛋品<span>></span></a></li>
                        <li><a href="/search/?keyword=%E8%82%89&page=0&size=10">精选肉类<span>></span></a></li>
                        <li><a href="/search/?keyword=%E6%B5%B7%E9%B2%9C&page=0&size=10">海鲜水产<span>></span></a></li>
                        <li><a href="/search/?keyword=%E5%86%B7%E5%86%BB&page=0&size=10">冷冻食品<span>></span></a></li>
                        <li><a href="/search/?keyword=%E9%85%92&page=0&size=10">中外名酒<span>></span></a></li>
                        <li><a href="/search/?keyword=%E8%BF%9B%E5%8F%A3&page=0&size=10">进口食品<span>></span></a></li>
                        <li><a href="/search/?keyword=%E4%BC%91%E9%97%B2&page=0&size=10">休闲食品<span>></span></a></li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
    <!-- nav模块结束 -->
    <!-- 商品分类模块开始 -->
    <div class="goods width">
        <div class="breadcrumb">
            <i>当前分类： </i>
            <a href="#">新鲜水果</a>
        </div>
        <ul class="goods_type_list" id = "id_goods_list">
            {% for item in goodsList %}
                <li id={{item.id}} class=g_item>
                    <a href='#'>
                        <img src={{item.img}}>
                        <span>{{ item.title }}</span>
                    </a>
                    <i>￥ {{ item.price }}</i>
                </li>
            {% endfor %}
        </ul>
        <div class="box1" style="height:100px;width: 100%;">
            <form action="" id="page-go" position = relative>
                <input type="text" id="page-num">
                <input type="submit" id="goto" value="Go">
            </form>
        </div>
    </div>
    <!-- 商品分类模块结束 -->
    <!-- 底部模块开始 -->
    <footer class="footer">
        <div class="width">
            <div class="mod_service">
                <ul>
                    <li>
                        <div class="service_icon1"></div>
                        <div class="text">
                            <h3>品类齐全，轻松购物</h3>
                        </div>
                    </li>
                    <li>
                        <div class="service_icon2"></div>
                        <div class="text">
                            <h3>多仓直发，极速配送</h3>
                        </div>
                    </li>
                    <li>
                        <div class="service_icon3"></div>
                        <div class="text">
                            <h3>正品行货，精致服务</h3>
                        </div>
                    </li>
                    <li>
                        <div class="service_icon4"></div>
                        <div class="text">
                            <h3>天天低价，畅选无忧</h3>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="mod_help">
                <dl>
                    <dt>
                        <a href="#">服务指南</a>
                    </dt>
                    <dd><a href="#">购物流程</a></dd>
                    <dd><a href="#">会员介绍</a></dd>
                    <dd><a href="#">生活旅行/团购</a></dd>
                    <dd><a href="#">常见问题</a></dd>
                    <dd><a href="#">联系客服</a></dd>
                </dl>
                <dl>
                    <dt><a href="#">配送方式</a></dt>
                    <dd><a href="#">上门自提</a></dd>
                    <dd><a href="#">211限时达</a></dd>
                    <dd><a href="#">配送服务查询</a></dd>
                    <dd><a href="#">配送费收取标准</a></dd>
                    <dd><a href="#">海外配送</a></dd>
                </dl>
                <dl>
                    <dt><a href="#">支付方式</a></dt>
                    <dd><a href="#">货到付款</a></dd>
                    <dd><a href="#">在线支付</a></dd>
                    <dd><a href="#">分期付款</a></dd>
                    <dd><a href="#">公司转账</a></dd>
                </dl>
                <dl>
                    <dt><a href="#">售后服务</a></dt>
                    <dd><a href="#">售后政策</a></dd>
                    <dd><a href="#">价格保护</a></dd>
                    <dd><a href="#">退款说明</a></dd>
                    <dd><a href="#">返修/退换货</a></dd>
                    <dd><a href="#">取消订单</a></dd>
                </dl>
                <dl>
                    <dt><a href="#">特色服务</a></dt>
                    <dd><a href="#">夺宝岛</a></dd>
                    <dd><a href="#">DIY装机</a></dd>
                    <dd><a href="#">延保服务</a></dd>
                </dl>
                <dl>
                    <dt>帮助中心</dt>
                    <dd class="qrcode">
                        <img src="/static/images/QRcode.png" alt="">
                    </dd>
                    下载客户端
                </dl>
            </div>
            <div class="mod_copyright">
                <div class="links">
                    <a href="#">关于我们</a>|
                    <a href="#">联系我们</a>|
                    <a href="#">联系客服</a>|
                    <a href="#">商家入驻</a>|
                    <a href="#">营销中心</a>|
                    <a href="#">友情链接</a>|
                    <a href="#">销售联盟</a>|
                    <a href="#">食品网社区</a>|
                    <a href="#">English Site</a>|
                    <a href="#">Contact U</a>|
                </div>
                <div class="copyright">
                    地址：内蒙古师范大学盛乐校区 邮编：010000 电话：400-123-1234 传真：010-12345678 邮箱: 1234567@567.com</br>
                    蒙ICP备08001234号蒙公网安备110123456789
                </div>
            </div>
        </div>
    </footer>
    <!-- 底部模块结束 -->
    <script>
        $(document).on('click','.g_item',function (){
            object = $(this)
            var host = window.location.origin
            window.open(host + "/goods/detail?id="+object.attr("id"))
        })
    </script>
    <script>
        $("#id_search").click(function (){
            var key = $("#id_key").val()
            window.location.href = "/search?keyword="+key+"&page="+0+"&size="+10;
        })
    </script>
    <script>
        $(document).ready(function(){
            carFunction()
        });
    </script>
    <script>
        const slp = new SimplePagination({{ total_page }})
        slp.init({
            container: '.box1',
            maxShowBtnCount: 3,
            onPageChange: state => {console.log('pagination change:', state.pageNumber)}
        })
      document.getElementById('page-go').addEventListener('submit', e => {
        e.preventDefault()
        slp.gotoPage(+document.getElementById('page-num').value)
      })
    </script>
    <script>
      var getGoods=function(page,size){
        $.ajax({
          url:'/goods/search',
          type:'get',
          data:{'page':page,'size':size},
          success:function (result) {
            var content = "";
            for(var i=0;i<result.length;++i){
              content+=
                  "<li id = "+result[i].id+" class=g_item>" +
                  "<a href='#'>" +
                  "   <img src="+ result[i].img+" alt=''>" +
                  "     <span>"+result[i].title+"</span>"+
                  "</a>" +
                  "<i>￥ "+result[i].price+"</i>" +
                  "</li>"
            }
            $("#id_goods_list").html(content)
          }
        })
      }
    </script>
</body>

</html>